package com.toy.core.service.support;

import org.apache.commons.io.IOUtils;

import com.mongodb.gridfs.GridFSDBFile;

public class GridFSDBFileWrapper {
	
	private GridFSDBFile gridFSDBFile;
	private byte[] bytes;

	public GridFSDBFileWrapper(GridFSDBFile gridFSDBFile) throws Exception{
		super();
		this.gridFSDBFile = gridFSDBFile;
		this.bytes = IOUtils.toByteArray(gridFSDBFile.getInputStream());
	}
	
	public String getFilename(){
		return gridFSDBFile.getFilename();
	}
	
	public Object getId(){
		return gridFSDBFile.getId();
	}

	public byte[] getBytes() {
		return bytes;
	}
	
}
